<!DOCTYPE html>
<html>
<head>
    <title>指标数据测试表</title>
		<#include "/header.html">
    <link rel="stylesheet" href="${request.contextPath}/statics/css/fileinput.min.css">
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
			<#if shiro.hasPermission("cs:zbsjdemo:save")>
            <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
			</#if>
			<#if shiro.hasPermission("cs:zbsjdemo:update")>
            <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
			</#if>
			<#if shiro.hasPermission("cs:zbsjdemo:delete")>
            <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
			</#if>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
														                    <div class="form-group">
                        <div class="col-sm-2 control-label">一级指标</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="zbsjdemo.oneZb" placeholder="一级指标"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">二级指标</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="zbsjdemo.secZb" placeholder="二级指标"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">指标名称</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="zbsjdemo.zbName" placeholder="指标名称"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">指标名称</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="zbsjdemo.js" placeholder="指标名称"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">指标层级</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="zbsjdemo.zbLevel" placeholder="指标层级"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">指标层级</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="zbsjdemo.filloutUnit" placeholder="指标层级"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">结果</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="zbsjdemo.zg" placeholder="结果"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">国家标准</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="zbsjdemo.nationalStandards" placeholder="国家标准"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">计算依据</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="zbsjdemo.calcuBasis" placeholder="计算依据"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">创建时间</div>
                        <div class="col-sm-10">
                            <input type="text" id="form_datetime" class="form-control" v-model="zbsjdemo.createTime" placeholder="创建时间"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">原始数据文件</div>
                        <div class="col-sm-10">
                            <input type="text" name="file" id="form_file1" multiple="multiple" accept="image/*,.zip,.pdf,.xls,.xlsx,.docx,.doc" class="form-control" v-model="zbsjdemo.oriDataFile" placeholder="原始数据文件"/>
                                                                </div>
                    </div>
							            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" id="btnSaveOrUpdate" data-loading-text="保存中..." @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>
</div>

<script src="${request.contextPath}/statics/libs/bootstrap-datetimepicker.min.js"></script>
<script src="${request.contextPath}/statics/libs/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="${request.contextPath}/statics/libs/fileinput.min.js"></script>
<script src="${request.contextPath}/statics/libs/zh.js"></script>
<script src="${request.contextPath}/statics/js/modules/cs/zbsjdemo.js?_${.now?long}"></script>

</body>
<script>
    // 时间组件
        $("#form_datetime").datetimepicker({
            format: 'yyyy-mm-dd',//显示格式
            startView:2,
            minView:2,
            maxView :2,
            language: 'zh-CN',
            autoclose: 1,//选择后自动关闭
            clearBtn:true,//清除按钮
        });
        // 当选择框隐藏时，将选择的值赋给时间字段
        $("#form_datetime").datetimepicker()
            .on('hide',function (ev) {
                var value = $("#form_datetime").val()
                vm.zbsjdemo.createTime = value;
            })

        // 文件上传组件
        $("#form_file").fileinput({
            uploadUrl:baseURL + "cs/zbsjdemo/uploadfile", //接受请求地址
            uploadAsync : true, //默认异步上传
            showUpload : true, //是否显示上传按钮,跟随文本框的那个
            showRemove : true, //显示移除按钮,跟随文本框的那个
            showCaption : true,//是否显示标题,就是那个文本框
            showPreview : true, //是否显示预览,不写默认为true
            dropZoneEnabled : false,//是否显示拖拽区域，默认不写为true，但是会占用很大区域
            //minImageWidth: 50, //图片的最小宽度
            //minImageHeight: 50,//图片的最小高度
            //maxImageWidth: 1000,//图片的最大宽度
            //maxImageHeight: 1000,//图片的最大高度
            //maxFileSize: 0,//单位为kb，如果为0表示不限制文件大小
            //minFileCount: 0,
            maxFileCount : 1, //表示允许同时上传的最大文件个数
            enctype : 'multipart/form-data',
            validateInitialCount : true,
            previewFileIcon : "<i class='glyphicon glyphicon-king'></i>",
            msgFilesTooMany : "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
            allowedFileExtensions : [ 'zip','xlsx','xls','pdf','docx','doc' ],//配置允许文件上传的类型
            // allowedPreviewTypes : [ 'image' ],//配置所有的被预览文件类型
            // allowedPreviewMimeTypes : [ 'jpg', 'png', 'gif' ],//控制被预览的所有mime类型
            language : 'zh'
        })
        //异步上传返回结果处理
        $('#form_file').on('fileerror', function(event, data, msg) {
            console.log("fileerror");
            console.log(data);
        });
        //异步上传返回结果处理
        $("#form_file").on("fileuploaded", function(event, data, previewId, index) {
            console.log("fileuploaded");
            var response = data.response;
            alert(response.filename);

            // $("#fileMd5").val(response.fileMd5);
            // $("#version").val(response.newVersionName);
            // $("#url").val(response.filePath);


        });

        //上传前
        $('#form_file').on('filepreupload', function(event, data, previewId, index) {
            console.log("filepreupload");
        });
</script>
</html>